package com.jaya.budan.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.jaya.budan.R;
import com.jaya.budan.base.BaseActivity;

public class My_Wallet_Activity extends BaseActivity implements View.OnClickListener {

    private RelativeLayout back;
    private LinearLayout ll_my_wallet_smrz, ll_my_wallet_my_yhk, ll_my_wallet_jyjl;
    private ImageView iv_my_wallet_cz, iv_my_wallet_tx;
    private TextView tv_my_wallet_money, tv_fill_bron, tv_my_wallet_yhk;
    private String access_token, money;
    private int is_certify, is_bank;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_wallet);
        Intent intent = getIntent();
        access_token = intent.getStringExtra("access_token");
        money = intent.getStringExtra("money");
        is_certify = intent.getIntExtra("is_certify", 0);
        is_bank = intent.getIntExtra("is_bank", 0);
        back = findViewById(R.id.back);
        ll_my_wallet_smrz = findViewById(R.id.ll_my_wallet_smrz);
        ll_my_wallet_my_yhk = findViewById(R.id.ll_my_wallet_my_yhk);
        ll_my_wallet_jyjl = findViewById(R.id.ll_my_wallet_jyjl);
        tv_my_wallet_money = findViewById(R.id.tv_my_wallet_money);
        tv_fill_bron = findViewById(R.id.tv_fill_bron);
        tv_my_wallet_yhk = findViewById(R.id.tv_my_wallet_yhk);
        iv_my_wallet_cz = findViewById(R.id.iv_my_wallet_cz);
        iv_my_wallet_tx = findViewById(R.id.iv_my_wallet_tx);
        back.setOnClickListener(this);
        ll_my_wallet_smrz.setOnClickListener(this);
        ll_my_wallet_my_yhk.setOnClickListener(this);
        ll_my_wallet_jyjl.setOnClickListener(this);
        iv_my_wallet_cz.setOnClickListener(this);
        iv_my_wallet_tx.setOnClickListener(this);
        tv_my_wallet_money.setText("" + money);
        if (is_certify == 0){
            tv_fill_bron.setText("未认证");
        } else {
            tv_fill_bron.setText("已认证");
        }
        if (is_bank == 0){
            tv_my_wallet_yhk.setText("暂未绑定");
        } else {
            tv_my_wallet_yhk.setText("已绑定");
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.iv_my_wallet_cz:
                Intent intent = new Intent(this, My_Wallet_Recharge_Activity.class);
                intent.putExtra("access_token", access_token);
                startActivity(intent);
                break;
            case R.id.iv_my_wallet_tx:
                Intent intent1 = new Intent(this, My_Wallet_Withdraw_Activity.class);
                intent1.putExtra("access_token", access_token);
                intent1.putExtra("money", money);
                intent1.putExtra("is_certify", is_certify);
                startActivity(intent1);
                break;
            case R.id.ll_my_wallet_smrz:
                Intent intent2 = new Intent(this, My_Wallet_RealName_Activity.class);
                intent2.putExtra("access_token", access_token);
                startActivity(intent2);
                break;
            case R.id.ll_my_wallet_my_yhk:
                Intent intent3 = new Intent(this, My_Wallet_Bind_BankCard_Activity.class);
                intent3.putExtra("access_token", access_token);
                startActivity(intent3);
                break;
            case R.id.ll_my_wallet_jyjl:
                Intent intent4 = new Intent(this, My_Wallet_JiLu_Activity.class);
                intent4.putExtra("access_token", access_token);
                startActivity(intent4);
                break;
            case R.id.back:
                finish();
                break;
            default:
                break;
        }
    }
}
